package ai.leinao.notify.dingtalk.domain;

import ai.leinao.notify.core.utils.TemplateUtils;
import cn.hutool.json.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.Collections;
import java.util.Map;

/**
 * 钉钉机器人Text消息
 *
 * @author zhong.wang
 * @date 2025/7/11
 */
@AllArgsConstructor
@Setter
@Getter
public class DingTalkRobotText {
    /**
     *  内容
     */
    private String content;

    public DingTalkRobotText render(Map<String, Object> context){
        return new DingTalkRobotText(TemplateUtils.simpleRender(content, context));
    }

    public JSONObject toJson() {
     return new JSONObject(Collections.singletonMap("content", content));
    }
}
